<template>
  <div id="container">
    <div id="output">
      <div class="containerT">
        <h1 style="font-size: 33px">在线视频监测管控平台</h1>

        <form class="form" id="login">
          <input type="text" v-model="username" placeholder="用户名" />
          <input
            type="password"
            v-model="password"
            placeholder="密码"
            @keydown.enter="login"
          />
          <button type="button" @click="login">登录</button>
          <!-- <div id="prompt" class="prompt"></div> -->
        </form>
      </div>
    </div>
  </div>
</template>

<script>
// import "../assets/js/jquery.min.js";
// import Victor from "victor";
import { Login } from "@/http";
// import qs from "qs";
export default {
  name: "Login",
  data() {
    return {
      username: "",
      password: "",
    };
  },
  // mounted() {
  //   new Victor(420, 1337);
  //   console.log(Victor);
  // },

  methods: {
    login() {
      // let data = { username, password };
      Login({ username: this.username, password: this.password }).then(
        (res) => {
          console.log(res);
          if (res.code == 200) {
            localStorage.setItem("Authorization", res.data.token);
            this.$store.commit("setUserName", this.username);
            localStorage.setItem("username", this.username);
            this.$router.push("/OnlineMap");
          } else {
            this.$message.warning("用户或密码错误");
          }
        }
      );
    },
  },
};
</script>
<style scoped lang="less">
#container {
  width: 100%;
  height: 100%;
  background: url("../assets/images/login.jpg") no-repeat center;
  background-position: center;
  background-size: 100% 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
}
#output {
  width: 100%;
  height: 100%;
}
.containerT {
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 3px;
  .bgcor(#fff);
  color: #081832;
  border-radius: 10px;
  padding: 25px 35px;
  box-shadow: 0 0 10px #081832;
}
.containerT h1 {
  font-size: 18px;
  font-family: microsoft yahei, Arial, sans-serif;
  -webkit-transition-duration: 1s;
  transition-duration: 1s;
  -webkit-transition-timing-function: ease-in-put;
  transition-timing-function: ease-in-put;
  font-weight: 500;
}
form {
  padding: 20px 0 10px;
  position: relative;
  z-index: 2;
  margin-top: 10px;
}
form input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background-color: rgba(255, 255, 255, 0.2);
  width: 200px;
  border-radius: 3px;
  padding: 8px 15px;
  margin: 0 auto 10px;
  display: block;
  text-align: center;
  font-size: 15px;
  color: #333;
  -webkit-transition-duration: 0.25s;
  transition-duration: 0.25s;
  font-weight: 300;
  border: 1px solid #ccc;
}
form input:hover {
  background-color: rgba(255, 255, 255, 0.4);
}
form input:focus {
  background-color: #fff;
  width: 230px;
  color: #333;
}
form button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: 0;
  background-color: #f17070;
  border: 0;
  padding: 10px 15px;
  color: #fff;
  border-radius: 3px;
  width: 200px;
  cursor: pointer;
  font-family: microsoft yahei, Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-top: 15px;
  -webkit-transition-duration: 0.25s;
  transition-duration: 0.25s;
}
form button:hover {
  background-color: #d34d4d;
}
</style>
